package ModelLayer;



public class OrderProducts
{
   
    private int quantity;
    private Product orderProduct;
    private double subTotal;
   
   
    public OrderProducts(Product newOrderProduct, int quantity)
    {
       orderProduct = newOrderProduct;
       this.quantity = quantity;
    }
    
    public void addProduct(Product newOrderProduct)
    {
        orderProduct = newOrderProduct;
    }  
    
  
    
    public int getQuantity()
    {
        return quantity;
    }
    
    public double getSubtotal()
    {
        subTotal = 0;
        subTotal=orderProduct.getPrice()*getQuantity();
        calculateDiscount();
        return subTotal;
    }

   private void calculateDiscount()
   {
       boolean productDiscount = false;
       int discount = orderProduct.getDiscountAmount();
       subTotal = subTotal - ((subTotal * discount)/100);
    }
    
}
